import sys
import os
import getpath
import myutil
# print(os.environ["PATH"])
# drive=os.path.splitdrive(getpath.getpath())[0]
#str_path=r"%s\nodejs;%s\nodejs\node_modules\.bin" % (drive,drive)
# print(str_path)
#os.environ["PATH"]=str_path
#rem .\out\Sqlectron-win32-ia32\sqlectron.exe

# fs=os.listdir(".")
# out=""
# for f in fs:
#     print(f)
#     (fn,ext)=os.path.splitext(f)
#     print(fn,ext)
#     # out+="""[%s](%s)\n""" %(md,md)
# print(out)
out=""
for (p,nouse,fs) in os.walk("."):
    for f in fs:
        filename=p+"/"+f
        # (fn1,ext)=os.path.splitext(filename)
        filename=filename[2:]
        (fn,ext)=os.path.splitext(filename)
        if ext==".md":
            print(p,fn,ext)
            out+="""[%s](%s)\n\n""" %(fn,fn)
print(out)
f=open("index.md","w")
f.write(out)
f.close()

